﻿using RuleOfReady.Core.DomainModels.Tiles;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RuleOfReady.Core.Test.Util
{
    public static class TileTestUtil
    {
        public static void AddEveryTile(ICollection<MahjongTile> tileTypes)
        {
            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Bamboo, 1));
            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Bamboo, 2));
            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Bamboo, 3));
            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Bamboo, 4));
            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Bamboo, 5));
            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Bamboo, 6));
            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Bamboo, 7));
            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Bamboo, 8));
            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Bamboo, 9));

            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Character, 1));
            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Character, 2));
            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Character, 3));
            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Character, 4));
            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Character, 5));
            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Character, 6));
            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Character, 7));
            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Character, 8));
            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Character, 9));

            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Dot, 1));
            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Dot, 2));
            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Dot, 3));
            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Dot, 4));
            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Dot, 5));
            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Dot, 6));
            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Dot, 7));
            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Dot, 8));
            tileTypes.Add(new MahjongSuitTile(MahjongSuitType.Dot, 9));

            tileTypes.Add(new MahjongHonorTile(MahjongHonorType.EastWind));
            tileTypes.Add(new MahjongHonorTile(MahjongHonorType.SouthWind));
            tileTypes.Add(new MahjongHonorTile(MahjongHonorType.WestWind));
            tileTypes.Add(new MahjongHonorTile(MahjongHonorType.NorthWind));
            tileTypes.Add(new MahjongHonorTile(MahjongHonorType.RedDragon));
            tileTypes.Add(new MahjongHonorTile(MahjongHonorType.WhiteDragon));
            tileTypes.Add(new MahjongHonorTile(MahjongHonorType.GreenDragon));
        }

        public static bool AllTileTypesInCollection(ICollection<MahjongTile> tileTypes)
        {
            var results = new List<bool>() 
            {
                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Bamboo, 1)),
                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Bamboo, 2)),
                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Bamboo, 3)),
                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Bamboo, 4)),
                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Bamboo, 5)),
                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Bamboo, 6)),
                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Bamboo, 7)),
                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Bamboo, 8)),
                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Bamboo, 9)),

                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Character, 1)),
                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Character, 2)),
                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Character, 3)),
                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Character, 4)),
                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Character, 5)),
                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Character, 6)),
                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Character, 7)),
                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Character, 8)),
                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Character, 9)),

                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Dot, 1)),
                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Dot, 2)),
                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Dot, 3)),
                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Dot, 4)),
                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Dot, 5)),
                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Dot, 6)),
                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Dot, 7)),
                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Dot, 8)),
                tileTypes.Contains(new MahjongSuitTile(MahjongSuitType.Dot, 9)),

                tileTypes.Contains(new MahjongHonorTile(MahjongHonorType.EastWind)),
                tileTypes.Contains(new MahjongHonorTile(MahjongHonorType.SouthWind)),
                tileTypes.Contains(new MahjongHonorTile(MahjongHonorType.WestWind)),
                tileTypes.Contains(new MahjongHonorTile(MahjongHonorType.NorthWind)),
                tileTypes.Contains(new MahjongHonorTile(MahjongHonorType.RedDragon)),
                tileTypes.Contains(new MahjongHonorTile(MahjongHonorType.WhiteDragon)),
                tileTypes.Contains(new MahjongHonorTile(MahjongHonorType.GreenDragon))
            };
            return results.All(res => res == true);
        }
    }
}
